Class sjl.Stack
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sjl.Stack

java.lang.Object
   |
   +----sjl.Stack

public class Stack
extends Object
Stack is a container adapter that provides a last-in, first-out protocol to the elements in the container. The container must implement the BackInsertContainer interface. The Vector, List and Deque containers implements the BackInsertContainer interface.

Copyright © 1996 Finn Bock

See Also:
Vector, Deque, List

Constructor Index

 o Stack(BackInsertContainer)
Construct a new Stack based on the container argument.

Method Index

 o empty()
Returns true if the stack does not contain any elements.
 o equals(Object)
Compare the elements in this container with the elements in another container.
 o pop()
Returns and removes the top element on the stack.
 o push(Object)
Insert a new element on the top of the Stack..
 o size()
Returns the number of elements stored in the vector.
 o top()
Return the top element of the Stack.

Constructors

 o Stack
  public Stack(BackInsertContainer container)
Construct a new Stack based on the container argument.

Methods

 o equals
  public boolean equals(Object container)
Compare the elements in this container with the elements in another container.
Returns:
true is the elements match.
Overrides:
equals in class Object
 o size
  public int size()
Returns the number of elements stored in the vector.
 o empty
  public boolean empty()
Returns true if the stack does not contain any elements.
 o pop
  public void pop()
Returns and removes the top element on the stack.
 o push
  public void push(Object o)
Insert a new element on the top of the Stack..
 o top
  public Object top()
Return the top element of the Stack. Undefined if the stack is empty.

All Packages  Class Hierarchy  This Package  Previous  Next  Index